import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (params) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/detail',
    method: 'get',
    params
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/submit',
    method: 'post',
    data: row
  });
};

// 下载 （获取excel模板）
export const getExcelTemplate = (params) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/export',
    method: 'get',
    responseType: 'blob',
    params
  });
};

// 导入 （获取excel模板）
export const excelImport = (id, row) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/import/' + id,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: row
  });
};
